<div class="pageheader notab">
    <h1 class="pagetitle">编辑角色</h1>
    <span class="pagedesc">请认真编辑角色的各项信息</span>       
</div><!--pageheader-->
     
<div id="contentwrapper" class="contentwrapper lineheight21">
<php>
$role_area = explode(',', $info['role_area']);
</php>
     <style>
     .stdform2 label { padding-top: 2px;padding-bottom:2px;}
     .stdform2 span.field, .stdform2 div.field { padding-top: 2px;padding-bottom:2px;}
     .blue { color:blue;font-weight:bold;}
     .green { color:green;font-weight:bold;}
     .gray { color:#666;font-weight:normal;}
     </style>
    <form class="stdform stdform2" method="post">
        <p>
            <label>角色名称</label>
            <span class="field"><input type="text" name="name" id="name" value="{$info.name}" class="smallinput" /></span>
        </p>
        <p class="checkbox_role">
            <label>角色权限</label>
            <span class="field green" style="margin-left: 12px;">
                <input type="checkbox" name="role_area[]" value="onlyunit" class=""
                <if condition="in_array('onlyunit', $role_area)">checked="checked"</if> 
                /> <font color="red">限制分院(T)</font>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="formsub" class="level-1"
                <if condition="in_array('formsub', $role_area)">checked="checked"</if> 
                /> 系统设置(L1)
			    <span class="field green" style="margin-left: 12px;">
			        <input type="checkbox" name="role_area[]" value="Configsite" class="level-1-1"
                    <if condition="in_array('Configsite', $role_area)">checked="checked"</if> 
                    /> 网站设置(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;">
			        <input type="checkbox" name="role_area[]" value="Configdist" class="level-1-3"
                    <if condition="in_array('Configdist', $role_area)">checked="checked"</if> 
                    /> 分销设置(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;">
			        <input type="checkbox" name="role_area[]" value="Configlevel" class="level-1-4"
                    <if condition="in_array('Configlevel', $role_area)">checked="checked"</if> 
                    /> 等级设置(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;">
			        <input type="checkbox" name="role_area[]" value="Configbanner" class="level-1-5"
                    <if condition="in_array('Configbanner', $role_area)">checked="checked"</if> 
                    /> 轮播图设置(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;">
			        <input type="checkbox" name="role_area[]" value="Configtpl" class="level-1-6"
                    <if condition="in_array('Configtpl', $role_area)">checked="checked"</if> 
                    /> 模板设置(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;">
			        <input type="checkbox" name="role_area[]" value="Configlogis" class="level-1-9"
                    <if condition="in_array('Configlogis', $role_area)">checked="checked"</if> 
                    /> 物流设置(L2)
			    </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="product"  class="level-2"
                <if condition="in_array('product', $role_area)">checked="checked"</if> 
                /> 商城系统(L1)
			    <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Productindex" class="level-2-1"
                    <if condition="in_array('Productindex', $role_area)">checked="checked"</if> 
                    /> 商品管理(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Productedit" class="level-2-1-1"
                    <if condition="in_array('Productedit', $role_area)">checked="checked"</if> 
                    /> 添加/修改
                    <input type="checkbox" name="role_area[]" value="Productdel" class="level-2-1-2"
                    <if condition="in_array('Productdel', $role_area)">checked="checked"</if> 
                    /> 删除                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Productcate" class="level-2-2"
                    <if condition="in_array('Productcate', $role_area)">checked="checked"</if> 
                    /> 商品分类(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Productcate_edit" class="level-2-2-1"
                    <if condition="in_array('Productcate_edit', $role_area)">checked="checked"</if> 
                    /> 添加/修改
                    <input type="checkbox" name="role_area[]" value="Productcate_del" class="level-2-2-2"
                    <if condition="in_array('Productcate_del', $role_area)">checked="checked"</if> 
                    /> 删除                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Orderindex" class="level-2-3"
                    <if condition="in_array('Orderindex', $role_area)">checked="checked"</if> 
                    /> 订单管理(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Orderdetail" class="level-2-3-1"
                    <if condition="in_array('Orderdetail', $role_area)">checked="checked"</if> 
                    /> 订单详情
                    <input type="checkbox" name="role_area[]" value="Orderdel" class="level-2-3-2"
                    <if condition="in_array('Orderdel', $role_area)">checked="checked"</if> 
                    /> 删除                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Bookingindex" class="level-2-4"
                    <if condition="in_array('Bookingindex', $role_area)">checked="checked"</if> 
                    /> 预约管理(L2)
                    {
                    <span class="gray">    
                    <input type="checkbox" name="role_area[]" value="Bookingdetail" class="level-2-4-1"
                    <if condition="in_array('Bookingdetail', $role_area)">checked="checked"</if> 
                    /> 查看预约信息                
                    <input type="checkbox" name="role_area[]" value="BookingcheckBooking" class="level-2-4-2"
                    <if condition="in_array('BookingcheckBooking', $role_area)">checked="checked"</if> 
                    /> 审核通过
                    <input type="checkbox" name="role_area[]" value="BookingbackcheckBooking" class="level-2-4-3"
                    <if condition="in_array('BookingbackcheckBooking', $role_area)">checked="checked"</if> 
                    /> 回退至未审核                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Bookingpq" class="level-2-5"
                    <if condition="in_array('Bookingpq', $role_area)">checked="checked"</if> 
                    /> 预约排期(L2)
                    {
                    <span class="gray">批量设置【
                    <input type="checkbox" name="role_area[]" value="BookingeditAllDefault" class="level-2-5-1"
                    <if condition="in_array('BookingeditAllDefault', $role_area)">checked="checked"</if> 
                    /> 默认策略
                    <input type="checkbox" name="role_area[]" value="BookingeditAllRest" class="level-2-5-2"
                    <if condition="in_array('BookingeditAllRest', $role_area)">checked="checked"</if> 
                    /> 休息策略
                    <input type="checkbox" name="role_area[]" value="BookingeditAllHoliday" class="level-2-5-3"
                    <if condition="in_array('BookingeditAllHoliday', $role_area)">checked="checked"</if> 
                    /> 假日策略】    指定日期【
                    <input type="checkbox" name="role_area[]" value="BookingeditAloneDefault" class="level-2-5-4"
                    <if condition="in_array('BookingeditAloneDefault', $role_area)">checked="checked"</if> 
                    /> 默认策略    
                    <input type="checkbox" name="role_area[]" value="BookingeditAloneRest" class="level-2-5-5"
                    <if condition="in_array('BookingeditAloneRest', $role_area)">checked="checked"</if> 
                    /> 休息策略    
                    <input type="checkbox" name="role_area[]" value="BookingeditAloneHoliday" class="level-2-5-6"
                    <if condition="in_array('BookingeditAloneHoliday', $role_area)">checked="checked"</if> 
                    /> 假日策略】    
                    </span>
                    }(L3)
                </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="admin"  class="level-3"
                <if condition="in_array('admin', $role_area)">checked="checked"</if> 
                /> 用户系统(L1)
			    <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Unitindex" class="level-3-1"
                    <if condition="in_array('Unitindex', $role_area)">checked="checked"</if> 
                    /> 分院管理(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Unitedit" class="level-3-1-1"
                    <if condition="in_array('Unitedit', $role_area)">checked="checked"</if> 
                    /> 添加/修改
                    <input type="checkbox" name="role_area[]" value="Unitdisabled" class="level-3-1-2"
                    <if condition="in_array('Unitdisabled', $role_area)">checked="checked"</if> 
                    /> 禁用/启用                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Roleindex" class="level-3-2"
                    <if condition="in_array('Roleindex', $role_area)">checked="checked"</if> 
                    /> 后台权限管理(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Roleedit" class="level-3-2-1"
                    <if condition="in_array('Roleedit', $role_area)">checked="checked"</if> 
                    /> 添加/修改                 
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Adminindex" class="level-3-3"
                    <if condition="in_array('Adminindex', $role_area)">checked="checked"</if> 
                    /> 管理员列表(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Adminedit" class="level-3-3-1"
                    <if condition="in_array('Adminedit', $role_area)">checked="checked"</if> 
                    /> 添加/修改      
                    <input type="checkbox" name="role_area[]" value="Admindisabled" class="level-3-3-2"
                    <if condition="in_array('Admindisabled', $role_area)">checked="checked"</if> 
                    /> 禁用/启用               
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Userindex" class="level-3-4"
                    <if condition="in_array('Userindex', $role_area)">checked="checked"</if> 
                    /> 会员列表(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Userdetail" class="level-3-4-1"
                    <if condition="in_array('Userdetail', $role_area)">checked="checked"</if> 
                    /> 详细信息                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Treeindex" class="level-3-5"
                    <if condition="in_array('Treeindex', $role_area)">checked="checked"</if> 
                    /> 会员树形关系(L2)
                </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="finance"  class="level-4"
                <if condition="in_array('finance', $role_area)">checked="checked"</if> 
                /> 财务系统(L1)<font color="red">*:此处权限涉及到现金操作,请谨慎授权</font>
			    <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Rewardindex" class="level-4-1"
                    <if condition="in_array('Rewardindex', $role_area)">checked="checked"</if> 
                    /> 绩效管理(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Rewardedit" class="level-4-1-1"
                    <if condition="in_array('Rewardedit', $role_area)">checked="checked"</if> 
                    /> 发放绩效                    
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Withdrawindex" class="level-4-2"
                    <if condition="in_array('Withdrawindex', $role_area)">checked="checked"</if> 
                    /> 提现管理(L2)
                    {
                    <span class="gray">                    
                    <input type="checkbox" name="role_area[]" value="Withdrawaudit" class="level-4-2-1"
                    <if condition="in_array('Withdrawaudit', $role_area)">checked="checked"</if> 
                    /> 审核通过    
                    <input type="checkbox" name="role_area[]" value="Withdrawrefuse" class="level-4-2-2"
                    <if condition="in_array('Withdrawrefuse', $role_area)">checked="checked"</if> 
                    /> 拒绝
                    <input type="checkbox" name="role_area[]" value="Financepay" class="level-4-2-3"
                    <if condition="in_array('Financepay', $role_area)">checked="checked"</if> 
                    /> 一键转账
                    <input type="checkbox" name="role_area[]" value="Withdrawconfirm" class="level-4-2-4"
                    <if condition="in_array('Withdrawconfirm', $role_area)">checked="checked"</if> 
                    /> 确认完成                
                    </span>
                    }(L3)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Financemch_pay_log" class="level-4-3"
                    <if condition="in_array('Financemch_pay_log', $role_area)">checked="checked"</if> 
                    /> 企业转账记录(L2)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Financedeposit_log" class="level-4-4"
                    <if condition="in_array('Financedeposit_log', $role_area)">checked="checked"</if> 
                    /> 转币记录(L2)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Financeseparate_log" class="level-4-5"
                    <if condition="in_array('Financeseparate_log', $role_area)">checked="checked"</if> 
                    /> 分成记录(L2)
                </span>
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Financefinance_log" class="level-4-6"
                    <if condition="in_array('Financefinance_log', $role_area)">checked="checked"</if> 
                    /> 账户变动记录(L2)
			    </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="report"  class="level-5"
                <if condition="in_array('report', $role_area)">checked="checked"</if> 
                /> 统计分析(L1)
			    <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Reportindex" class="level-5-1"
                    <if condition="in_array('Reportindex', $role_area)">checked="checked"</if> 
                    /> 数据报表(L2)
                </span>
                <span class="field green" style="margin-left: 12px;"> 
                    <input type="checkbox" name="role_area[]" value="Reportinstant" class="level-5-2"
                    <if condition="in_array('Reportinstant', $role_area)">checked="checked"</if> 
                    /> 实时数据(L2)
			    </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="Noticeindex"  class="level-6"
                <if condition="in_array('Noticeindex', $role_area)">checked="checked"</if> 
                /> 通知公告管理(L1)
                <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Noticeedit" class="level-6-1"
                    <if condition="in_array('Noticeedit', $role_area)">checked="checked"</if> 
                    /> 发布公告(L2)
                </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="Selfmenuindex"  class="level-7"
                <if condition="in_array('Selfmenuindex', $role_area)">checked="checked"</if> 
                /> 自定义菜单管理(L1)
			    <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Selfmenuedit" class="level-7-1"
                    <if condition="in_array('Selfmenuedit', $role_area)">checked="checked"</if> 
                    /> 添加/修改(L2)
                </span>
                <span class="field green" style="margin-left: 12px;"> 
                    <input type="checkbox" name="role_area[]" value="Selfmenudel" class="level-7-2"
                    <if condition="in_array('Selfmenudel', $role_area)">checked="checked"</if> 
                    /> 删除(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;"> 
                    <input type="checkbox" name="role_area[]" value="Selfmenusend" class="level-7-3"
                    <if condition="in_array('Selfmenusend', $role_area)">checked="checked"</if> 
                    /> 发布自定义菜单(L2)
			    </span>
            </span>
            <span class="field blue">
                <input type="checkbox" name="role_area[]" value="Autoreplyindex"  class="level-8"
                <if condition="in_array('Autoreplyindex', $role_area)">checked="checked"</if> 
                /> 自定义回复管理(L1)
			    <span class="field green" style="margin-left: 12px;">
                    <input type="checkbox" name="role_area[]" value="Autoreplyedit" class="level-8-1"
                    <if condition="in_array('Autoreplyedit', $role_area)">checked="checked"</if> 
                    /> 添加/修改(L2)
                </span>
                <span class="field green" style="margin-left: 12px;"> 
                    <input type="checkbox" name="role_area[]" value="Autoreplydel" class="level-8-2"
                    <if condition="in_array('Autoreplydel', $role_area)">checked="checked"</if> 
                    /> 删除(L2)
			    </span>
			    <span class="field green" style="margin-left: 12px;"> 
                    <input type="checkbox" name="role_area[]" value="Autoreplyset_status" class="level-8-3"
                    <if condition="in_array('Autoreplyset_status', $role_area)">checked="checked"</if> 
                    /> 启用/停用(L2)
			    </span>
            </span>
        </p>
        <p class="stdformbutton">
            <button class="submit radius2">提交</button>
            <input type="reset" class="reset radius2" value="重置" />
        </p>
    </form>     	
</div><!--contentwrapper-->
<script type="text/javascript">
jQuery(document).ready(function(d){
	$ = jQuery;
	$("[class^='level-']").click(function(){
		var chk = this.checked;
		
		var classname = $(this).attr("class");
		var arr = new Array(); // 定义一数组 
		arr=classname.split("-"); // 字符分割
		
		var arr_length = arr.length;
		if(arr_length == 2){ // 选择第一级
			// 自动选择二三级
			$("[class^='"+classname+"']").each(function(){
				this.checked=chk;
			});
		}else if(arr_length == 3){ // 选择第二级
			// 自动选择三级
			$("[class^='"+classname+"']").each(function(){
				this.checked=chk;
			});
			// 自动选择一级
			if(chk){
				$(".level-"+arr[1]).attr("checked",true);
			}
		}else if(arr_length == 4){ // 选择第三级
			// 自动选择第一级、第二级
			if(chk){
				$(".level-"+arr[1]).attr("checked",true);
				$(".level-"+arr[1]+"-"+arr[2]).attr("checked",true);
			}
		}
	});
	/* $(".checkbox_role input[type=checkbox]").bind("click",function() {
		parentCheck(this);
		childCheck(this);
	});

	function parentCheck(chk) {
		var obj = $(chk).parent().parent().parent();
		if(obj && obj.attr("class").indexOf("checkbox_role")!=-1) {
			if(chk.checked) {
				$(chk).parent().parent().children().attr("checked",true);
			}
		}
	}
	function childCheck(chk) {
		var obj = $(chk).parent().parent();
		if(obj && obj.attr("class").indexOf("checkbox_role")!=-1){
			$(chk).parent().children().find("input[type=checkbox]").each(function(){
					this.checked=chk.checked
					
				}
			);
		}
	} */
});

</script>        